package org.example.hansp.array_.array_exercise;

public class ArraySumMajorDiagonal {
    public static void main(String[] args) {
        double[][] array={{1,2,3,4.0},{5,6.5,7,8},{9,10,11,12},{13,14,15,16}};
        System.out.println(sumMajorDiagonal(array));
    }
    public static double sumMajorDiagonal(double[][] array) {
        double sum = 0.0;
        for (int i = 0; i < array.length; i++) {

            sum += array[i][i];


        }
        return sum;
    }
}
